#include "classifierselector.h"
#include "ui_classifierselector.h"
#include "database/databasequery.h"
#include "database/dbtabclassifierproduct.h"
#include "classifierprteditor.h"
#include <QLayout>

ClassifierSelector::ClassifierSelector(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ClassifierSelector)
{
    ui->setupUi(this);
    DataBaseQuery query;
    QStringList keyList;
    keyList<<DBTabClassifierProduct::_NAME
          <<DBTabClassifierProduct::_R1_LOW<<DBTabClassifierProduct::_R1_HI
             <<DBTabClassifierProduct::_R2_LOW<<DBTabClassifierProduct::_R2_HI
               <<DBTabClassifierProduct::_R3_LOW<<DBTabClassifierProduct::_R3_HI
                 <<DBTabClassifierProduct::_R4_LOW<<DBTabClassifierProduct::_R4_HI
                   <<DBTabClassifierProduct::_R5_LOW<<DBTabClassifierProduct::_R5_HI
                     <<DBTabClassifierProduct::_R6_LOW<<DBTabClassifierProduct::_R6_HI
                       <<DBTabClassifierProduct::_R7_LOW<<DBTabClassifierProduct::_R7_HI
                         <<DBTabClassifierProduct::_R8_LOW<<DBTabClassifierProduct::_R8_HI
                           <<DBTabClassifierProduct::_R9_LOW<<DBTabClassifierProduct::_R9_HI
                             <<DBTabClassifierProduct::_R10_LOW<<DBTabClassifierProduct::_R10_HI
                               <<DBTabClassifierProduct::_R11_LOW<<DBTabClassifierProduct::_R11_HI
                                 <<DBTabClassifierProduct::_R12_LOW<<DBTabClassifierProduct::_R12_HI;
    query.selectTable(DBTabClassifierProduct::TAB_NAME,&keyList);
    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->setSpacing(2);
   // while (query.next()) {

        ClassifierPrtEditor* editor = new ClassifierPrtEditor("abc"/*query.value(0).toString()*/,this);
        //editor->setMaximumHeight(100);
        layout->addWidget(editor);
    //}
    ui->scrollAreaWidget->setLayout(layout);
}

ClassifierSelector::~ClassifierSelector()
{
    delete ui;
}
